Ext.onReady(function() {
	var aptTemplate = new Ext.Template('<div class="apartment" >'
					+ '	<a onclick="javascript:showRooms(\'{aptID}\',\'{aptName}\');return false;" href="#">'
					+ '			<img src="../../images/b1.jpg" style="border:1px  solid white" onmouseover="this.style.border=\'1px groove black\'"'
					+ '			onmouseout="this.style.border=\'1px  solid white\'"  width="120px" height="120px" />'
					+ '	</a>' + '	<div >' + '	    {aptName}' + '		<br />'
					+ '		楼层数为：{aptfloorNum}' + '		<br />'
					+ '		房间数为：{aptRoomNum}' + '	</div>' + '</div>');
	var aptHTML = '';
	var mycallback = function setList(aptValue) {
		gaptInfo = aptValue;
		for (var i = 0; i < aptValue.length; i++) {
			aptHTML = aptHTML + aptTemplate.apply({
				aptID : aptValue[i].apartmentid,
				aptName : aptValue[i].apartmentname,
				aptfloorNum : aptValue[i].apartmentfloornum,
				aptRoomNum : aptValue[i].apartmenttotalrooms
					// apartmentid, apartmentname, apartmentfloornum,
					// apartmentmgrname,
					// apartmenttelephone, apartmenttotalrooms, apartmentind,
					// apartmentavailrooms
				});
		};
		Ext.getCmp('ftPanel').update(aptHTML);
	}
	apartmentViewAction.getAllApartInfo(mycallback);
	var centerPanel = new Ext.TabPanel({
				id : 'tabs',
				frame : false,
				region : 'center',
				activeTab : 0,
				items : [{
							id : 'ftPanel',
							title : '房态查询',
							autoScroll : true,
							html : 'aptShow'
						}]
			});
	// 布局
	var viewport = new Ext.Viewport({
				layout : 'border',
				items : [centerPanel]
			});

	Ext.get('loading').remove();
});
function showRooms(aptID, aptName) {
	Ext.getCmp('tabs').add({
		title : aptName,
		closable : true,
		html : "<iframe id='iframe_center' name='iframe_center' src='listroom.jsp' "
				+ "width='100%' height='100%' frameborder=0 border=0/>"
	}).show();
}